package it.clem.little.domain.terreno;

import it.clem.little.domain.combat.ICombatRoundStrategy;

public class Match {
  private ICombatRoundStrategy combatRoundStrategy;
  private final int MAX_NUM_ROUND=200;

  public ICombatRoundStrategy getCombatRoundStrategy() {
    return combatRoundStrategy;
  }

  public void setCombatRoundStrategy(ICombatRoundStrategy combatRoundStrategy) {
    this.combatRoundStrategy = combatRoundStrategy;
  }
  
  public boolean disputaMatch(Terreno terreno) {
    int currentRound=0;
    while (!terreno.terminato() && currentRound++ < MAX_NUM_ROUND){
      combatRoundStrategy.doCombatRound(terreno);
      terreno.rimuoviCaduti();
    }
    //il pareggio lo considero sconfitta.
    return terreno.vittoria();
  }
}
